<?php require admin_tpl('header'); ?>

<div class="tab">
	<ul>
		<li><a href="?mod=page&ac=list" class="on">页面管理</a></li>
		<li><a href="?mod=page&ac=create">创建页面</a></li>
		<li><a href="?mod=page&ac=pagemeta">自定义域</a></li>
	</ul>
</div>

<div class="main">
	<form name="op" method="post" action="?mod=page">
	<table cellspacing="0" class="datalist" id="list">
		<tr>
			<th width="30" class="firstcol">选择</th>
			<th width="60">ID</th>
			<th>标题</th>
			<th width="200">父页面</th>
			<th width="120">作者</th>
			<th width="80">阅读</th>
			<th width="80">评论</th>
			<th width="150">创建时间</th>

		</tr>
		<?php
		if ( count($result) ) {
			foreach ( $result as $row ) {
		?>
		<tr id="row_<?php echo $row['id'];?>">
			<td align="center"><input type="checkbox" name="id[]" value="<?php echo $row['id']?>" class="checkbox" /></td>
			<td align="center"><?php echo $row['id']?></td>
			<td>
			<a href="?mod=page&ac=create&id=<?php echo $row['id']?>" title="编辑这个页面"><?php echo $row['title']?></a>
			<?php
			switch ($row['status']) {
				case 0 :
					echo '<span style="color:red">[隐藏]</span>';break;
				case -1 :
					echo '<span style="color:red">[草稿]</span>';break;;
			}
			if (!empty($row['password'])) {
				echo '<img src="admin/images/lock.gif" alt="密码访问" />';
			}
			?>
			</td>
			<td align="center">
			<?php 
			if ( $row['parent_id'] ) {
				echo '<a href="?mod=page&ac=create&id='.$row['parent_id'].'">'.$row['parent_title'].'</a>';
			} else { echo '无'; }
			?>
			</td>
			<td align="center"><?php echo $row['username']?></td>
			<td align="center"><b style="color:red"><?php echo $row['views']?></b></td>
			<td align="center"><a href="?mod=comment&postid=<?php echo $row['id']?>" title="查看该文章下的评论"><b style="color:green"><?php echo $row['comments']?></b></a></td>
			<td align="center"><?php echo get_date($row['dateline'],'Y-m-d H:i')?></td>
		</tr>
		<?php }?>
			<tr><td colspan="10"><?php echo multipage()?></td></tr>
			<tr>
				<td align="center"><input type="checkbox" name="chkall" value="1" class="checkbox" id="chkall" onclick="check_all(this)" /></td>
				<td align="center"><label for="chkall">全选</label></td>
				<td colspan="8">
				<input type="radio" name="ac" id="delete" value="delete" class="radio" /><label for="delete">删除</label>
				<input type="radio" name="ac"  id="upstat" value="upstat" class="radio" /><label for="upstat">状态</label>
				<select name="status" onfocus="$('#upstat').attr('checked','checked')">
					<option value="1">公开</option>
					<option value="0">隐藏</option>
					<option value="-1">草稿</option>
				</select>
				<input type="submit" class="submit" value="执行操作"  />
				</td>
			</tr>
		<?php
		} else {
			echo '<tr><td colspan="10">当前还没有页面</td></tr>';
		}
		?>
	</table>
	</form>
</div>
<?php require admin_tpl('footer'); ?>